import express from 'express';
import { prisma } from '../service/mysql.js';
import { TaskStatus } from '../plugins/schedule/type.js';
const router = express.Router();

router.get('/schedule-tasks', async (req, res, next) => {
    const page = req.query.page;
    const pageSize = 20;
    const records = await prisma.t_schedule_task.findMany({
        where: {
            status: TaskStatus.VALID
        },
        skip: (page - 1) * pageSize,
        take: pageSize
    });
    res.json({
        success: true,
        message: '',
        data: records
    });
});

export default router;